package com.gp.node.operator;

import com.gp.node.INode;
import com.stock.StockData;

//this class implement NOT operator
//functions description can be found at the interface IOperatorUnary 
public class Not extends IOperatorUnary{

	private static final long serialVersionUID = 240820806391977997L;

	@Override
	public double getValue(StockData stock) {
		return -1 * child.getValue(stock);
	}

	@Override
	public INode createNew() {
		return  new Not();
	}
	
	@Override
	public INode copy() {
		Not node = new Not();
		node.setChild(this);
		return node;
	}
	
	@Override
	public String print(StockData stock) {
		return " !("+ child.print(stock)+")";
	}

	@Override
	public String print() {
		return " !("+ child.print()+")";
	}

}
